package com.wuliu.controller;

import com.wuliu.common.core.domain.ApiResult;
import com.wuliu.system.domain.TspTrack;
import com.wuliu.system.service.ITspTrackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.hibernate.validator.constraints.Length;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @author realue
 * @version 1.0
 * @date 2023-10-27 15:50
 */
@Api(tags = {"路由管理控制"})
@RestController
@RequestMapping("/app/track")
public class TspTrackController {

    @Resource
    private ITspTrackService tspTrackService;

    @GetMapping("/getTracks")
    @ApiOperation(value = "查询运单路由", notes = "")
    @ApiImplicitParam(name = "orderNo", value = "运单号", required = true, dataType = "string", paramType = "query")
    public ApiResult<List<TspTrack>> getTracks(String orderNo) {
        if (orderNo.length() < 6) {
            return ApiResult.error("请输入长度大于5的运单号");
        }
        return ApiResult.success(tspTrackService.getTracks(orderNo));
    }
}
